﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ConfApp.Models;

namespace ConfApp.ViewModels
{
    public class TwittViewModel
    {
        private Twitt _twitt;
        public TwittViewModel(Twitt twitt)
        {
            _twitt = twitt;
        }

        public string Text { get { return _twitt.Text; } }
        public string Footer
        {
            get
            {
                var dt = Time.Now - _twitt.Date;
                if(dt.TotalMinutes<1)
                {
                    return string.Format("{0}, malopre", _twitt.User);
                }
                if(dt.TotalMinutes<60)
                {
                    return string.Format("{0}, pre {1} min", _twitt.User, (int)dt.TotalMinutes);
                }
                else if(dt.TotalHours<24)
                {
                    return string.Format("{0}, pre {1} h", _twitt.User, (int)dt.TotalHours);
                }
                return string.Format("{0} @ {1:dd.MM.yyyy.}", _twitt.User,_twitt.Date);
            }
        }
    }
}
